// /////////////////////////////////////////////////////////////////////////////
//
// Name:            asSceneComponent.cpp
// Author:          Michael Bartsch (ZCCdark203)
//
// Desc :           Binds the SceneComponent class to AngelScript
//
// License:         Copyright (C) 2009 Michael Bartsch and Contributors
//
//                  This program is free software: you can redistribute it
//                  and/or modify it under the terms of the zlib/libpng License.
//                  See main.cpp for conditions of distribution and use.
//
// /////////////////////////////////////////////////////////////////////////////

// Include files
#include "asSceneComponent.h"

#ifdef __COMPILE_WITH_ANGELSCRIPT__

#include "../../ScriptHelper.h"


//! Reference factory for the SceneComponent class.
SceneComponent* createSceneComponent(Entity* parent)
{
    return new SceneComponent(parent);
}

//! Binds the SceneComponent class to AngelScript.
void bindSceneComponent(asIScriptEngine *engine)
{
    // Forward declarations.
    int r;

    // Bind SceneComponent class.
    r = engine->RegisterObjectType("SceneComponent", sizeof(SceneComponent), asOBJ_REF); assert(r >= 0);

    // Bind base functions.
    bindSceneComponentBase<SceneComponent>(engine, "SceneComponent");

    // Set SceneComponent behaviour.
    r = engine->RegisterObjectBehaviour("SceneComponent", asBEHAVE_FACTORY, "SceneComponent@ f(Entity @+)",
                                        asFUNCTIONPR(createSceneComponent, (Entity*), SceneComponent*),
                                        asCALL_CDECL); assert(r >= 0);

    r = engine->RegisterObjectMethod("SceneComponent", "SceneComponent& opAssign(const SceneComponent &in)",
                                        asFUNCTION(assignT<SceneComponent>), asCALL_CDECL_OBJFIRST); assert(r >= 0);
}

#endif // __COMPILE_WITH_ANGELSCRIPT__

// End of File
